Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: modify gas oracle TS tooling to be friendly for all protocol types #5198

Open
wants to merge 28 commits into
base: main
Choose a base branch
from

Conversation

tkporter
Copy link
Collaborator

@tkporter tkporter commented Jan 17, 2025

Description

  • Part of a greater effort to consolidate gas oracle configuration
  • Adds a script ./scripts/sealevel-helpers/print-gas-oracles.ts that outputs all SVM gas oracles that can be plugged into SVM tooling (opening a separate PR for the SVM tooling bits)
  • Attempts to simplify and consolidate tooling for generating gas oracle configuration. We no longer have duped logic in infra, and instead impose min USD costs by still using an SDK function. The SDK function now generates gas oracle configurations that are specific to the origin smart contract requirements
  • Doing a fork test shows that the quotes are the exact same as before

Drive-by changes

Related issues

Backward compatibility

Testing

Copy link

changeset-bot bot commented Jan 17, 2025

⚠️ No Changeset found

Latest commit: e72bf6c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

codecov bot commented Jan 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.53%. Comparing base (49856fb) to head (e72bf6c).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5198   +/-   ##
=======================================
  Coverage   77.53%   77.53%           
=======================================
  Files         103      103           
  Lines        2110     2110           
  Branches      190      190           
=======================================
  Hits         1636     1636           
  Misses        453      453           
  Partials       21       21           
Components Coverage Δ
core 87.80% <ø> (ø)
hooks 79.39% <ø> (ø)
isms 83.68% <ø> (ø)
token 91.27% <ø> (ø)
middlewares 79.80% <ø> (ø)

typescript/utils/src/amount.ts Outdated Show resolved Hide resolved
typescript/sdk/src/hook/EvmHookReader.ts Outdated Show resolved Hide resolved
typescript/infra/scripts/agent-utils.ts Outdated Show resolved Hide resolved
typescript/infra/src/config/gas-oracle.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@paulbalaji paulbalaji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to fix lint

}

// Make the exchange rate an integer by scaling it up by the appropriate factor for the protocol.
let exchangeRate = getProtocolExchangeRate(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let exchangeRate = getProtocolExchangeRate(
const exchangeRate = getProtocolExchangeRate(

parseFloat(gasOracleParams[remote].gasPrice.amount) *
Math.pow(10, gasOracleParams[remote].gasPrice.decimals);
if (isNaN(gasPrice)) {
let gasPrice = new BigNumberJs(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let gasPrice = new BigNumberJs(
const gasPrice = new BigNumberJs(

@@ -1,19 +1,18 @@
import { Provider } from '@ethersproject/providers';
import { BigNumber as BigNumberJs } from 'bignumber.js';
import { assert } from 'console';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think you actually wanted import { assert} from '@hyperlane-xyz/utils'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

2 participants